package com.jinmdz.fmis.mapper.mapper;

import com.jinmdz.fmis.mapper.entity.CremationCertificatePrintingHistoryEntity;
import com.jinmdz.fmis.mapper.mapper.provider.CremationCertificatePrintingHistoryProvider;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

/**
 * 火化证打印历史记录表Mapper
 *
 * @author generator
 * @date 2020-03-12 17:08
 */
public interface CremationCertificatePrintingHistoryMapper {

    /**
     * 增加CremationCertificatePrintingHistory
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @InsertProvider(type = CremationCertificatePrintingHistoryProvider.class, method = "insertCremationCertificatePrintingHistory")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertCremationCertificatePrintingHistory(@Param("entity") CremationCertificatePrintingHistoryEntity entity);

    /**
     * 删除CremationCertificatePrintingHistory
     *
     * @param id             主键
     * @param modifiedUserId 修改用户外键
     * @param version        版本号
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @Update(" update cremation_certificate_printing_history set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForCremationCertificatePrintingHistory(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改CremationCertificatePrintingHistory
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @UpdateProvider(type = CremationCertificatePrintingHistoryProvider.class, method = "updateCremationCertificatePrintingHistory")
    void updateCremationCertificatePrintingHistory(@Param("entity") CremationCertificatePrintingHistoryEntity entity);

    /**
     * 查询CremationCertificatePrintingHistory实体
     *
     * @param id 主键
     * @return CremationCertificatePrintingHistoryEntity
     * @author generator
     * @date 2020-03-12 17:08
     */
    @Select(" select id,deleted,business_code,member_id,member_name,member_gender_code,certificate_type_code,certificate_no,member_relation,mobile_phone,other_phone,address,cremation_old_no,cremation_new_no,operation_type_code,operation_time,operation_cause,remark,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from cremation_certificate_printing_history where id = #{id} and deleted = 0 limit 1 ")
    CremationCertificatePrintingHistoryEntity getCremationCertificatePrintingHistoryById(@Param("id") Integer id);

    /**
     * 查询CremationCertificatePrintingHistory列表
     *
     * @param entity 数据实体
     * @return CremationCertificatePrintingHistoryEntity
     * @author generator
     * @date 2020-03-12 17:08
     */
    @SelectProvider(type = CremationCertificatePrintingHistoryProvider.class, method = "listCremationCertificatePrintingHistory")
    ArrayList<CremationCertificatePrintingHistoryEntity> listCremationCertificatePrintingHistory(@Param("entity") CremationCertificatePrintingHistoryEntity entity);
}